#ifndef EXP_FIND_HPP
#define EXP_FIND_HPP

#include <type_traits>
namespace exp_utilities {
    namespace exp_find_detail {
        template<class IDX, class T, class TL> struct find_impl;

        template<class IDX, class T, template<class...> class TL, class First, class... Ts>
        struct find_impl<IDX, T, TL<First, Ts...>> {
            using type = typename std::conditional_t<
                std::is_same<T, First>::value,
                std::integral_constant<std::size_t, IDX::value>,
                typename find_impl<
                    std::integral_constant<std::size_t, IDX::value + 1>,T, TL<Ts...>
                >::type
            >;
            
        };

        template<class IDX, class T, template<class...> class TL>
        struct find_impl<IDX, T, TL<>> {
            using type = IDX; // idx overflow
        };
    }

    template<class T, class TL>
    using exp_find = typename exp_find_detail::find_impl<std::integral_constant<std::size_t, 0>, T, TL>::type;

#include"exp_size.hpp"
    template<class T, class TL>
    using exp_try_find = std::integral_constant<bool, (max_index<TL> >= exp_find<T, TL>::value)>;
}
#endif // !EXP_FIND_HPP
